﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ninject.Modules;
using ReAnimation.Infrastructure.Services.Interfaces;
using ReAnimation.Infrastructure.Services;
using ReAnimation.Domain.Services;
using Castle.DynamicProxy;
using ReAnimation.Helpers.DynamicProxy;

namespace ReAnimation.Modules
{
    public class ServicesModule: NinjectModule
    {
        private static ProxyGenerator _proxyGenerator = new ProxyGenerator();
        public override void Load()
        {
            Bind<IZMatrixService>().To<ZMatrixService>();
            Bind<IOpenBabelService>().To<OpenBabelService>();
            Bind<IAnimationToPOVService>().To<AnimationToPOVService>();
            Bind<IAnimationStoreService>().To<AnimationStoreService>();

            Bind<IApplicationSettings>().ToMethod((c) =>
                {
                   return _proxyGenerator.CreateClassProxy<ApplicationSettingsService>(new[] 
                   { new EventsSourceInterceptor()});
                }).InSingletonScope();
        }
    }
}